<?xml version="1.0" encoding="utf-8"?>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ page  contentType="text/html; charset=UTF-8" %>  
 	
	<%@include file="loading.jsp" %>	
  	<script type="text/javascript">
		     function okButton(){
     
       $('#exlcuir').click();
       divSumir();
     };
   
		
</script>
   <sj:dialog id="mybuttondialog" buttons="{'OK':function() {okButton();$(this).dialog('close');},'Cancel':function() { $(this).dialog('close'); } }" autoOpen="false" modal="true" title="Excluir Registro" effect="explode" hideEffect="explode">
     Excluir Usuário?
    </sj:dialog>
    
    <s:url id="urlexcluirusuario" action="excluirusuario!deleteUser">
			<s:param name="login"><s:property value="usuario.login"/>
			</s:param>
			</s:url>
			<sj:a href="%{urlexcluirusuario}" targets="main" indicator="indicator" id="exlcuir"></sj:a>
  <div id="divsumir" name="divsumir">
  <s:form action="salvarusuario!saveUser" theme="simple" method="post" id="form" enctype="multipart/form-data">
  	 

  	 <div id="nav">
      <!-- skiplink anchor: navigation -->
      <a id="navigation" name="navigation"></a>

      <div class="hlist">
        <ul>
         
          <li>
          	<sj:a onclick="divSumir();" id="ajaxformlink" formIds="form"  targets="main" indicator="indicator" >Salvar
    		</sj:a>
          	
	      </li>
	      <s:if test="%{login != null && !login.isEmpty()}">
	      	<li>
          		<sj:a openDialog="mybuttondialog">Excluir</sj:a>	
          	</li>
          	</s:if>
          
          
        </ul>
      </div>
    </div>	
  	<s:actionerror cssClass="ui-state-error ui-corner-all" cssStyle="padding: 0pt 0.7em;"/>  	 
  	<s:actionmessage cssClass="ui-state-highlight ui-corner-all" cssStyle="padding: 0pt 0.7em; margin-top: 20px;"/>
		
	 <fieldset class="ui-widget ui-widget-content ui-corner-all" style="margin: 10px">
  	 		<legend class="ui-state-default ui-corner-all">&nbsp;&nbsp;&nbsp;Usuário&nbsp;&nbsp;&nbsp;</legend>
  	 		<br>
		<table width="100%">
		<tr valign="top" style="height: 40px;">	
			<td>
    			<s:label value="Login:"/>    		
    			<s:if test="%{login == null || login.isEmpty()}">
					<s:textfield name="usuario.login" />
				</s:if>
				<s:else>
					<s:property value="usuario.login"/>
					<s:hidden name="login"/>
					<s:hidden name="usuario.login"/>
				</s:else>	
			</td>		
			<td>
    			<s:label value="Senha:"/>    			
				<s:textfield name="usuario.senha" />
			</td>
			<td>
    			<s:label value="Perfil:"/>
    			<s:select name="usuario.perfil" list="perfis"/>
    			
			</td>
			
		</tr>
		
		     			
     			
			</table>
			
		
		
	</fieldset>	
	
	
	<fieldset class="ui-widget ui-widget-content ui-corner-all" style="margin: 10px">	
	<legend class="ui-state-default ui-corner-all">&nbsp;&nbsp;&nbsp;Pessoal&nbsp;&nbsp;&nbsp;</legend>
  	 		<br>
     <table style="align: left;  width: 100%">    
    	<tr valign="top" style="height: 40px;">
    		<td >
    			<s:label value="Nome:" />
    			
				<s:textfield name="usuario.nome" cssStyle="width: 250px"/>
			</td>
		
    		<td>
    			<s:label value="Nascimento:"/>
    			
				<sj:datepicker name="usuario.dataNascimento" changeYear="true" displayFormat="dd/mm/yy" buttonImageOnly="true" cssStyle="width: 80px"/>
				
			</td>
			
			<td>
    			<s:label value="Profissão:"/>
    		
				<s:textfield name="usuario.ramoAtuacao" cssStyle="width: 250px"/>
			</td>			
		</tr>
		<tr valign="top" style="height: 40px;">
			<td>
    			<s:label value="UF:"/>
    		
				<s:select name="usuario.uf" list="ufs"/>
			</td>
			
		
    		<td colspan="3">
    			<s:label value="Email:"/>
    		
				<s:textfield name="usuario.email" cssStyle="width: 350px"/>
			</td>
		</tr>
		<tr>	
			<td valign="top" colspan="2">
    			<s:label value="Telefone(s):" />
    		
				<s:textarea name="usuario.telefones" cols="50" cssStyle="width: 300px" />
			</td>
			<td valign="top" colspan="2">
    			<s:label value="Endereço:" />
    			
				<s:textarea name="usuario.endereco" cols="50" cssStyle="width: 300px"/>
			</td>
		</tr>
		
			<tr valign="top">	
			
			<td>
				<s:label value="Foto:"/>
			</td>
			
    		<td>	
				<s:file name="upload" label="Arquivo" cssStyle="width: 200px" />					
			</td>			
			
			
		
		
		</tr>
	</table>
	</fieldset>
	
 </s:form>
 </div>
 	

